﻿@model GosWeb.Models.Db.Biont
@using GosWeb.Models.Db
@using GosWeb.Biz
@{
    string gRatioStyle=string.Empty;
    Biont self = Model as Biont;
}
    @{

        Biont ancestor_1 = null, ancestor_2 = null, ancestor_1_1 = null, ancestor_1_2 = null, ancestor_1_1_1 = null, ancestor_1_1_2 = null, ancestor_1_2_1 = null, ancestor_1_2_2 = null,
            ancestor_2_1 = null, ancestor_2_2 = null, ancestor_2_1_1 = null, ancestor_2_1_2 = null, ancestor_2_2_1 = null, ancestor_2_2_2 = null;
        // Biont 
        if (self == null)
        {
            Html.Label("不存在祖先！可能此ID不存在或是始祖", "出错啦:");
        }
        else
        {
            gRatioStyle = "style =\"color:Green\"";
            if (Model.IsGeneRatioCompletion() == false)
            {
                gRatioStyle = "style =\"color:Red\"";
            }
            //---------------

            BiontBiz bb = BiontBiz.GetInstance();
            ancestor_1 = bb.FindBiont(self.FatherID);
            if (ancestor_1 is Biont)
            {
                ancestor_1_1 = (ancestor_1 as Biont).GetFather();
                if (ancestor_1_1 is Biont)
                {
                    ancestor_1_1_1 = (ancestor_1_1 as Biont).GetFather();
                    ancestor_1_1_2 = (ancestor_1_1 as Biont).GetMother();
                }
                ancestor_1_2 = (ancestor_1 as Biont).GetMother();
                if (ancestor_1_2 is Biont)
                {
                    ancestor_1_2_1 = (ancestor_1_2 as Biont).GetFather();
                    ancestor_1_2_2 = (ancestor_1_2 as Biont).GetMother();
                }
            }

            ancestor_2 = bb.FindBiont(self.MotherID);
            if (ancestor_2 is Biont)
            {
                ancestor_2_1 = (ancestor_2 as Biont).GetFather();
                if (ancestor_2_1 is Biont)
                {
                    ancestor_2_1_1 = (ancestor_2_1 as Biont).GetFather();
                    ancestor_2_1_2 = (ancestor_2_1 as Biont).GetMother();
                }
                ancestor_2_2 = (ancestor_2 as Biont).GetMother();
                if (ancestor_2_2 is Biont)
                {
                    ancestor_2_2_1 = (ancestor_2_2 as Biont).GetFather();
                    ancestor_2_2_2 = (ancestor_2_2 as Biont).GetMother();
                }
            }
        }
    }
    <div style="font-size: 28px; font-family: 隶书; text-align: center;">
        <br />
        <b>
            江西省新干县雪山种猪场
            <br />
            种猪档案证明</b></div>
    <br />
    <br />
    <br />
    <table>
        <tr>
            <td>
                <img width="220" alt="" src="../../Content/Pic/zhutou.png" />
            </td>
            <td>
                <fieldset>
                    <legend>个体详细资料 （Biont Detail Information) </legend>
                    <table style="width: 450px; border-width: 0px; border-color: Black; border-style: solid;
                        text-align: left">
                        <tr>
                            <td class="display-label" align="right">
                                @Html.LabelFor(model => model.BiontID):
                            </td>
                            <td class="display-field">@Html.ActionLink(Model.BiontID, "Details", new { id = Model.BiontID })
                            </td>
                            <td class="display-label" align="right">
                                @Html.LabelFor(model => model.GenesShortStr):
                            </td>
                            <td class="display-field">@Model.GenesShortStr
                            </td>
                        </tr>
                        <tr>
                            <td class="display-label" align="right">
                                @Html.LabelFor(model => model.Sex):
                            </td>
                            <td class="display-field">@Model.SexStr
                            </td>
                            <td class="display-label" align="right">
                                @Html.LabelFor(model => model.Birthday):
                            </td>
                            <td class="display-field">
                                @if (Model.Birthday.HasValue)
                                {
                                    @Model.Birthday.Value.ToShortDateString()  
                                }
                            </td>
                        </tr>
                        <tr>
                            <td class="display-label" align="right">
                                @Html.LabelFor(model => model.LeftTitNumber):
                            </td>
                            <td class="display-field">@Model.LeftTitNumber
                            </td>
                            <td class="display-label" align="right">
                                @Html.LabelFor(model => model.RightTitNumber):
                            </td>
                            <td class="display-field">@Model.RightTitNumber
                            </td>
                        </tr>
                        <tr>
                            <td class="display-label" align="right">
                                @Html.LabelFor(model => model.Weight):
                            </td>
                            <td class="display-field">
                                @{@Model.Weight}
                                kg
                            </td>
                            <td class="display-label" align="right">
                                @Html.LabelFor(model => model.NestNumber):
                            </td>
                            <td class="display-field">@Model.NestNumber
                            </td>
                        </tr>
                        <tr>
                            <td class="display-label" style="text-align: right">
                                出生场:
                            </td>
                            <td class="display-field" colspan="1">@BiontBiz.GetInstance().GetSiteString(Model.Address.Site)
                            </td>
                            <td class="display-label" align="right">
                                同窝数:
                            </td>
                            <td class="display-field" colspan="1">@BiontBiz.GetInstance().GetCountOfSameNest(Model)
                            </td>
                        </tr>
                        <tr>
                            <td class="display-label" align="right">
                                个体号:
                            </td>
                            <td class="display-field" colspan="3">@Model.GetLongID()
                            </td>
                        </tr>
                        <!--tr>
                            <td class="display-field" colspan="6">
                                <span style="color: #666666; font-size: small">(ID编号说明:如"LD-XS-00001-04"，"LD"是品名，表示"长白杜洛克";<br />
                                    XS是猪场代号："雪山猪场";"00001-04"是耳缺号） </span>
                            </td>
                        </tr-->
                    </table>
                    <!--pre style="width: 100%; white-space: pre-wrap;">@Model.PubInfo</pre-->
                </fieldset>
            </td>
        </tr>
    </table>
    <hr />
    <br />
    <fieldset>
    <legend><span style="font-size:18px;">祖先3代图 (3 Generation Ancestor)</span></legend>
    <div style="font-size: 14px; background-repeat: no-repeat; height: 335px;">
        <img alt="" src="../../Content/Pic/PrintTree.png" style="position: absolute;" />
        <div style="position: absolute; padding-left: 8px; padding-top: 160px">
            <!-- 0 -->
            <b>@Html.Raw(self.GetLongID())</b>
        </div>
        <div style="position: absolute; padding-left: 172px; padding-top: 77px">
            <!-- 1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1))
        </div>
        <div style="position: absolute; padding-left: 170px; padding-top: 240px">
            <!--  2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2))
        </div>
        <div style="position: absolute; padding-left: 320px; padding-top: 34px">
            <!--  1.1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_1))
        </div>
        <div style="position: absolute; padding-left: 320px; padding-top: 116px">
            <!-- 1.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_2))
        </div>
        <div style="position: absolute; padding-left: 320px; padding-top: 199px">
            <!--  2.1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_1))
        </div>
        <div style="position: absolute; padding-left: 320px; padding-top: 282px">
            <!-- 2.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_2))
        </div>
        <div style="position: absolute; padding-left: 526px; padding-top: 12px">
            <!-- 1.1.1-->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_1_1))
        </div>
        <div style="position: absolute; padding-left: 526px; padding-top: 53px">
            <!-- 1.1.2-->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_1_2))
        </div>
        <div style="position: absolute; padding-left: 526px; padding-top: 93px">
            <!-- 1.2.1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_2_1))
        </div>
        <div style="position: absolute; padding-left: 526px; padding-top: 133px">
            <!-- 1.2.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_1_2_2))
        </div>
        <div style="position: absolute; padding-left: 526px; padding-top: 175px">
            <!-- 2.1.1 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_1_1))
        </div>
        <div style="position: absolute; padding-left: 526px; padding-top: 217px">
            <!-- 2.1.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_1_2))
        </div>
        <div style="position: absolute; padding-left: 526px; padding-top: 259px">
            <!-- 2.2.1  -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_2_1))
        </div>
        <div style="position: absolute; padding-left: 526px; padding-top: 302px">
            <!-- 2.2.2 -->
            @Html.Raw(BiontBiz.GetPrintDetailStr(ancestor_2_2_2))
        </div>
    </div>
    </fieldset>
    <hr />
    <br />
    <div style="font-size: 18px; text-align: center;">
      <b>猪场信息 (Pig Farm Information)</b> 
    </div>
    <br />
    <table width="700">
        <tr>
            <td class="display-label" align="right">
                地 址:
            </td>
            <td class="display-field">
                江西省新干县金川镇灌溪村上圩岭
            </td>
            <td class="display-label" align="right">
                电 话:
            </td>
            <td class="display-field">
                0796 - 2627 998
            </td>
        </tr>
        <tr>
            <td class="display-label" align="right">
                联系人:
            </td>
            <td class="display-field">
                范平云
            </td>
            <td class="display-label" align="right">
                传 真:
            </td>
            <td class="display-field">
                0796 - 2627 997
            </td>
           
        </tr>
        <tr>
            <td class="display-label" align="right">
                电子邮箱:
            </td>
            <td class="display-field">
                573432828@qq.com
            </td>
            <td class="display-label" align="right">
                网 址:
            </td>
            <td class="display-field">
             <a href="http://www.xgxszc.com">http://www.xgxszc.com</a>   
            </td>
        </tr>
        <tr>
            <td class="display-label" align="right">
                制表日期:
            </td>
            <td class="display-field">@DateTime.Today.ToShortDateString()
            </td>
            <td class="display-label" align="right">
                <b>单位(盖章):</b>
            </td>
            <td class="display-field">
            </td>
        </tr>
    </table>